<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改用户')"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body>
<div class="main-content">
    <form class="form-horizontal" id="form-user-edit" th:object="${user}">
        <input name="userId" type="hidden" th:field="*{userId}"/>
        <h4 class="form-header h4">基本信息</h4>
        <div class="row">
            <div class="col-sm-9">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">用户名称：</label>
                    <div class="col-sm-8">
                        <input name="userName" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30"
                               th:field="*{userName}" required>
                    </div>
                </div>
            </div>

        </div>

        <div class="row">
            <div class="col-sm-9">
                <div class="form-group">
                    <label class="col-sm-4 control-label">用户性别：</label>
                    <div class="col-sm-8">
                        <select name="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                    th:field="*{sex}"></option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-9">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">登录账号：</label>
                    <div class="col-sm-8">
                        <input class="form-control" type="text" readonly="true" th:field="*{loginName}"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">

            <div class="col-sm-9">
                <div class="form-group">
                    <label class="col-sm-4 control-label">重置密码：</label>
                    <div class="col-sm-8" id="toPassword">

                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-9">
                <div class="form-group" >
                    <label class="col-xs-4 control-label">角色：</label>
                    <div class="col-xs-8">
                        <label th:each="role:${roles}" class="check-box" >
                            <input name="role" type="checkbox" th:value="${role.roleId}" th:text="${role.roleName}"
                                   th:checked="${role.flag}" disabled="" >
                        </label>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <form class="form-horizontal" th:object="${wxUser}">
        <h4 class="form-header h4">员工微信</h4>
        <div class="row">
            <div class="col-sm-9">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">手机号码：</label>
                    <div class="col-sm-8">

                        <input id="phoneNum" class="form-control" type="text" th:field="*{phoneNum}" readonly="true" >
                           
                    </div>

                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-9">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">微信昵称：</label>
                    <div class="col-sm-8">
                        <input class="form-control" type="text" readonly="true" th:field="*{nickName}"/>
                    </div>
                </div>
            </div>
        </div>

    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<script type="text/javascript">
    var prefix = ctx + "emp/emp";

    $(function () {
        $('#post').select2({
            placeholder: "请选择岗位",
            allowClear: true
        });
        $('#toPassword').html('<input class="form-control" type="text"  onclick="resetPwd(' + $('#userId').val() + ')" placeholder="点击进入重置密码页面">')
    })

    /* 用户管理-重置密码 */
    function resetPwd(userId) {
        var url = prefix + "/resetPwd/" + userId;
        $.modal.open("重置密码", url, '800', '300');
    }
</script>
</body>
</html>